package com.buddies.lottery.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

public class ObservableScrollView extends ScrollView {
  
    private OnScrollChangedListener mListener;
  
    public ObservableScrollView(Context context) {
        super(context);  
    }  
  
    public ObservableScrollView(Context context, AttributeSet attrs,
                                int defStyle) {
        super(context, attrs, defStyle);  
    }  
  
    public ObservableScrollView(Context context, AttributeSet attrs) {  
        super(context, attrs);  
    }  
  
    public void setOnScrollChangedListener(OnScrollChangedListener listener) {
        mListener = listener;
    }  
  
    @Override  
    protected void onScrollChanged(int x, int y, int oldx, int oldy) {  
        super.onScrollChanged(x, y, oldx, oldy);  
        if (mListener != null) {
            mListener.onScrollChanged(x, y, oldx, oldy);
        }  
    }

    public interface OnScrollChangedListener {

        void onScrollChanged(int x, int y, int oldx, int oldy);

    }
  
}  
